<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>评论表单</title>
    <script type="text/javascript" src="../../js/jquery-3.4.1.js"></script>
    <link rel="stylesheet" href="../../js/layui/css/layui.css" media="all"/>
    <script src="../../js/layui/layui.js" charset="utf-8"></script>

</head>
<body>


<div id="updateReload">
    <div id="updateOperation">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>评论信息维护</legend>
        </fieldset>
        <form id="updateMess" class="layui-form" method="post" >
            <input type="hidden" name="comId" id="comId" >

            <div class="layui-form-item">
                <label class="layui-form-label">评论内容</label>
                <div class="layui-input-block">
                    <input type="text" name="comContent" id="comContent" lay-verify="required"  class="layui-input" style="width:280px;">
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">评论时间</label>
                <div class="layui-input-block">
                    <input type="date" name="comTime" id="comTime"  placeholder="评论时间"  class="layui-input" style="width:280px;">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">用户ID</label>
                <div class="layui-input-block">
                    <input type="text" name="userId" id="userId"  maxlength="11" placeholder="用户ID" autocomplete="off"  class="layui-input" style="width:280px;">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">电影ID</label>
                <div class="layui-input-block">
                    <input type="text" name="movieId" id="movieId"  maxlength="11" placeholder="电影ID" autocomplete="off"  class="layui-input" style="width:280px;">
                </div>
            </div>





            <div class="layui-form-item">
                <div class="layui-input-block">
                    <input type="submit" lay-submit lay-filter="update" id="update" class="layui-btn" value="提交">
                    <button id="closeUpdate" type="button" class="layui-btn layui-btn-primary" >取消</button>
                </div>
            </div>
        </form>
    </div>


</div>
<script>
    layui.use(['form' ,'transfer','layer', 'util'],function () {
        form = layui.form
            ,transfer = layui.transfer
            , layer = layui.layer
            ,util = layui.util;

        form.on('submit(update)', function (data) {
            console.info(data.field);
            if (data.field.comId == null || data.field.comId == ''){
                url = "../../verycdComment/add";
            }
            var data2 = data.field;

            $.post(url, data2, function (resp) {
                if (resp.state == 1) {
                    parent.layui.table.reload("idTest");
                    var index = parent.layer.getFrameIndex(window.name);
                    parent.layer.close(index);
                    parent.layer.msg(resp.msg);
                }
            }, "JSON")
            return false;
        })



    });

</script>

</body>
</html>